package day_12;

import java.util.Scanner;
import java.util.Stack;

public class ques2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Stack<Integer> min=new Stack<>();
        Stack<Integer>max=new Stack<>();
        // 注意 hasNext 和 hasNextLine 的区别
        while (scan.hasNextInt()) { // 注意 while 处理多个 case
            int A = scan.nextInt();
            for(int i=1;i<A;i++){
                if(isSingle(i)){
                    for(int j=1;j<A;j++){
                        if(isSingle(j)&&(i+j)==A){
                            int Ma=Math.max(i,j);
                            int Mi=Math.min(i,j);
                            if(min.isEmpty()){
                                min.push(Mi);
                                max.push(Ma);
                            }
                            if((Ma-Mi)<(max.peek()-min.peek())){
                                min.pop();
                                max.pop();
                                min.push(Mi);
                                max.push(Ma);
                            }


                        }
                    }
                }
            }

            System.out.println(min.pop());
            System.out.println(max.pop());


        }
    }

    public static boolean isSingle(int a){
        int cout=0;
        for(int i=1;i<=a;i++){
            if(a%i==0){
                cout++;
            }
        }
        return cout==2;
    }
}
